package com.qding.park.manager.app.queue.handle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.qding.park.common.core.exceptions.BaseException;
import com.qding.park.manager.facade.queue.service.DelayCheckFacade;
import com.qding.park.manager.pojo.TbCarlock;
import com.qding.park.manager.pojo.queue.QueueMsg;

/**
 * @ClassName CarLockTimeOutHandle
 * @Description TODO(锁车单超时)
 * @author Administrator
 * @Date 2016年9月17日 下午2:45:19
 * @version 1.0.0
 */
@Component("carLockTimeOutHandle")
public class CarLockTimeOutHandle extends AbstractAllHandle {
	
	/**
	 * @Field @lockCarFacade : TODO(锁车业务核心模块)
	 */
	@Autowired
	private DelayCheckFacade delayCheckFacade;
	
	@Override
	void actualHandle(QueueMsg msg) throws BaseException {
		JSONObject data = (JSONObject) msg.getData();
		TbCarlock tbCarlock =data.toJavaObject(TbCarlock.class);
		delayCheckFacade.lockTimeOut(tbCarlock);
	}

	@Override
	boolean failDiscardRollBacK(QueueMsg msg) {
		_log.error("锁车单超时任务回滚:"+msg);
		return true;
	}

}
